apiVersion: v1
kind: Service
metadata:
  name: redis-master
  namespace: spark-cluster
  labels:
    app: redis
    role: master
    tier: backend
spec:
  type: NodePort
  ports:
    # the port that this service should serve on
  - port: 6379
    targetPort: 6379
    nodePort: 30379
    name: redis-master-port
  - port: 22
    targetPort: 22
    nodePort: 30322
    name: redis-master-ssh
  selector:
    app: redis
    role: master
    tier: backend

---
apiVersion: v1
kind: ReplicationController
metadata:
  name: redis-master
  namespace: spark-cluster
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: redis
        role: master
        tier: backend
    spec:
      containers:
      - name: master
        image: index.tenxcloud.com/zhangshun/redis:3.2.3
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort: 6379
        - containerPort: 22
        volumeMounts:
        - mountPath: /data
          name: glusterfsvol
      volumes:
      - name: glusterfsvol
        glusterfs:
            endpoints: glusterfs-cluster
            path: {{ gluster_rta_redis_volname }}
            readOnly: false
